import gtk


def _layout_paned(pane, children):
    if len(children) == 1:
        return children[0]
    p = pane()
    p.pack1(children[0], resize = True)
    p.pack2(cls._pack_paned(children[1:]), resize = True)
    p.show()
    return p

def _layout(box, pane, children):
    obj = box()
    obj.show()
    if not children:
        return obj
    obj._pack_start(_layout_paned(pane, children))
    return obj

def HLayout(*children):
    return _layout(gtk.HBox, gtk.HPaned, children)

def VLayout(*children):
    return _layout(gtk.VBox, gtk.VPaned, children)

def HFixed(child):
    obj = gtk.HBox()
    obj.pack_start(child, expand = False, fill = False)
    obj.show()
    return obj

def VFixed(child):
    obj = gtk.VBox()
    obj.pack_start(child, expand = False, fill = False)
    obj.show()
    return obj

def Fixed(child):
    return VFixed(HFixed(child))



